﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Icoders.MarketTracker.Core.Repository.Transaction;
using Icoders.MarketTracker.Web.Lib.Command.Orders;

namespace Icoders.MarketTracker.Web.Lib.CommandHandler.Orders.Impl
{
   public class CreateOrderCommandHandler : ICreateOrderCommandHandler
   {
       private IPurchaseOrderRepository _purchaseOrderRepository;

       public CreateOrderCommandHandler(IPurchaseOrderRepository purchaseOrderRepository)
       {
           _purchaseOrderRepository = purchaseOrderRepository;
       }

       public void Execute(CreateOrderCommand cmd)
       {
           try
           {
               _purchaseOrderRepository.Create(
                   cmd.DocId, cmd.CmdPopId, cmd.CmdClientId, cmd.CmdGenByUserId,
                                               cmd.CmdGenByAppId, cmd.CmdDateCreated, cmd.CmdSendDateTime);
           }
           catch(Exception ex)
           {
               throw ex;
           }
       }
    }
}
